home *** CD-ROM | disk | FTP | other *** search
- -- Inicializacao dos metodos de manipulacao de string
- -- Deve ser chamado uma vez antes de utilizar os outros
- -- metodos
- on utilInicializa
-
- global gAcentos_pc, gAcentos_mac, gConvertido
- -- Lista dos codigos dos acentos no PC
- put [225, 193, 233, 201, 237, 205, 243, 211, 250, 218, 226, 194, ¬
- 234, 202, 238, 206, 244, 212, 251, 219, 227, 195, 245, 213, ¬
- 241, 209, 224, 192, 232, 200, 236, 204, 242, 210, 249, 217, ¬
- 231, 199, 228, 196, 235, 203, 239, 207, 246, 214, 252, 220] ¬
- into gAcentos_pc
- -- Acentos Mac
- put [135, 231, 142, 131, 146, 234, 151, 238, 156, 242, 137, 229, ¬
- 144, 230, 148, 235, 153, 239, 158, 243, 139, 204, 155, 205, ¬
- 150, 132, 136, 203, 143, 233, 147, 237, 152, 241, 157, 244, ¬
- 141, 130, 138, 128, 145, 232, 149, 236, 154, 133, 159, 134] ¬
- into gAcentos_mac
- put "aaeeiioouuaaeeiioouuaaoonnaaeeiioouuccaaeeiioouu"¬
- into gConvertido
- end
-
- on pcToMac texto
- global gAcentos_pc, gAcentos_mac, gConvertido
-
- set num = the number of chars in texto
- set res = ""
- repeat with i = 1 to num
- set c = char i of texto
- set tmp = getPos(gAcentos_pc, charToNum(c))
- if tmp <> 0 then set c = NumToChar(getAt(gAcentos_mac,tmp))
- set res = res & c
- end repeat
-
- return res
- end
-
-
- -- Tira acentos e coloca tudo minusculo
- on canoniza pal
- global gAcentos_pc, gAcentos_mac, gConvertido
-
- put "" into res
- put 1 into counter
- put length(pal) into len
- repeat while counter <= len
- put charToNum(char counter of pal) into c
- if (c >= charToNum("A") and c <= charToNum("Z")) then
- put c - charToNum("A") + charToNum("a") into c
- else
- if the platform contains "Win" then
- put getPos(gAcentos_pc, c) into tmp
- else -- Mac
- put getPos(gAcentos_mac, c) into tmp
- end if
- if tmp <> 0 then
- put charToNum(char tmp of gConvertido) into c
- end if
- end if
- put numToChar(c) after res
- put counter + 1 into counter
- end repeat
- return res
- end
-
- -- Verifica se e' letra
- on e_letra c
- global gAcentos_pc, gAcentos_mac, gConvertido
-
- if c >= "A" and c <= "Z" then return true
- if c >= "a" and c >= "z" then return true
-
- if the platform contains "Win" then
- put getPos(gAcentos_pc, charToNum(c)) into tmp
- else -- Mac
- put getPos(gAcentos_mac, charToNum(c)) into tmp
- end if
- if tmp > 0 then return true
-
- return false
- end
-
- -- Faz italicos para textos que nao tem hipertexto
- on fazItalicos textoMember
- set mem = the number of member textoMember
- set texto = the text of member mem
- set c = 1
- set italico = false
- set w = the number of words in texto
- put "Palavras a serem percorridas: " & w
- repeat while c <= w
- set pal = word c of texto
- if pal contains "{" then
- set italico = true
- end if
- if italico then
- set the fontStyle of word c of member mem to "italic"
- end if
- if pal contains "}" then
- set italico = false
- end if
- set c = c + 1
- if c mod 25 = 0 then
- put ". " & c
- end if
- end repeat
- end
-
- on fazNegrito textoMember
- set mem = the number of member textoMember
- set texto = the text of member mem
- set c = 1
- set negrito = false
- set w = the number of words in texto
- put "Palavras a serem percorridas: " & w
- repeat while c <= w
- set pal = word c of texto
- if pal contains "[" then
- set negrito = true
- end if
- if negrito then
- set the fontStyle of word c of member mem to "bolt"
- end if
- if pal contains "]" then
- set negrito = false
- end if
- set c = c + 1
- if c mod 25 = 0 then
- put ". " & c
- end if
- end repeat
- end